
#pragma once

#include <vector>
#include <string>

//Parsers URI-requests and provides required data.
class UriParser
{
	public:
		enum UriType
		{
			GetFile,
			ProcessAction,
			ShowMuzzle
		};
	private:
		UriType _type;
		std::vector<std::pair<std::string, std::string>> _args;
		std::string _fileName;
	public:
		//Creates parser for given URI (e.g. "/dot_white.png").
		//In case of error throws std::exception.
		UriParser(const char *uri);
		//Returns type of the URI.
		inline UriType GetType()
		{ return _type; }
		//Returns argument with given name as int.
		//In case of error return false.
		bool GetIntArgument(const char *name, size_t &value);
		//Returns argument with given name as string.
		//In case of error return false.
		bool GetStringArgument(const char *name, const char *&value);
		//Returns name of the required file.
		inline const char *GetFileName()
		{ return _fileName.c_str(); }
};